www.gusucode.com > XerCMS 携云PHP企业建站程序 v2015PHP源码程序 > XerCMS 携云PHP企业建站程序 v2015/XerCMS_v20150724/XerCMS_v20150724/Assets/uekit/kits/tabs.js
/* * Name: User Experience Toolkit(UEKit) * Ver: 1.0.0 * Author: Arno * QQ: 1328013 * Link: http://www.uekit.com */ function tabs() { this.head = typeof(arguments[0]) != 'undefined' ? arguments[0] : {}; this.body = typeof(arguments[1]) != 'undefined' ? arguments[1] : {}; this.method = typeof(arguments[2]) != 'undefined' ? arguments[2] : 'mouseover'; this.name = 'selected'; if(typeof(tabs.Inst) == 'undefined') { tabs.prototype.set = function(ts) { this.head = ts;var self = this; for(var i = 0;i < ts.length;i++) { ts[i].attr('i',i); ts[i].bind(this.method,function(){self.show(this.attr('i'));}); } } tabs.prototype.reset = function() { for(var i = 0;i < this.head.length;i++) { this.head[i].class(this.name,false); if(typeof(this.body[i]) == 'object') { this.body[i].hide(); } } } tabs.prototype.show = function(index) { this.reset(); this.head[index].class(this.name); if(typeof(this.body[index]) == 'object') { this.body[index].show(); } else { var o = $('#' + this.head[index].attr('body')); if(o != null) { this.body[index] = o; o.show(); } } } } tabs.Inst = true; }